package com.esm.tool;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.esm.netity.Orderinfo;
import com.esm.view.MainActivity;
import com.esm.view.R;

import java.util.List;

public class PoAdapter extends BaseAdapter {
    private MainActivity mContext = null;
    private List<Orderinfo> mData;
    private ViewHolder holder;

    public PoAdapter(MainActivity lushuUtils, List<Orderinfo> data) {
        mContext = lushuUtils;
        mData = data;
    }

    @Override
    public int getCount() {
        return mData.size();
    }

    public void setData(List<Orderinfo> mData) {
        this.mData = mData;
    }


    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(final int position, View convertView, ViewGroup parent) {
        if (convertView == null) {
            convertView = LayoutInflater.from(mContext).inflate(R.layout.item_gv4, parent, false);
            holder = new ViewHolder();
            holder.id = (TextView) convertView.findViewById(R.id.gv4_id);
            convertView.setTag(holder);
        } else {
            holder = (ViewHolder) convertView.getTag();
        }
        holder.id.setText(mData.get(position).getPo());
        return convertView;

    }

    static final class ViewHolder {
        TextView id;
    }

}
